﻿namespace ACCOUNTING
{
    using ACCOUNTING.LVY.Business;
    using ACCOUNTING.My;
    using ACCOUNTING.My.Resources;
    using Microsoft.VisualBasic;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms;

    [DesignerGenerated]
    public class Frm_RptDoanhThuTongHop : Form
    {
        private static List<WeakReference> __ENCList = new List<WeakReference>();
        [AccessedThroughProperty("CmdCancel")]
        private Button _CmdCancel;
        [AccessedThroughProperty("CmdOK")]
        private Button _CmdOK;
        [AccessedThroughProperty("CobDonVi")]
        private ComboBox _CobDonVi;
        [AccessedThroughProperty("DTP_NgayBatDau")]
        private DateTimePicker _DTP_NgayBatDau;
        [AccessedThroughProperty("DTP_NgayKetThuc")]
        private DateTimePicker _DTP_NgayKetThuc;
        [AccessedThroughProperty("GBTuyChon")]
        private GroupBox _GBTuyChon;
        [AccessedThroughProperty("LBDenNgay")]
        private Label _LBDenNgay;
        [AccessedThroughProperty("LBDonVi")]
        private Label _LBDonVi;
        [AccessedThroughProperty("LBTuNgay")]
        private Label _LBTuNgay;
        [AccessedThroughProperty("Panel1")]
        private Panel _Panel1;
        private IContainer components;
        private bool mAllowAdd;
        private bool mAllowDel;
        private bool mAllowEdit;
        private bool mAllowView;

        [DebuggerNonUserCode]
        public Frm_RptDoanhThuTongHop()
        {
            base.Load += new EventHandler(this.Frm_RptHTongDoanhThuBanHang_Load);
            List<WeakReference> list = __ENCList;
            lock (list)
            {
                __ENCList.Add(new WeakReference(this));
            }
            this.InitializeComponent();
        }

        private void CmdOK_Click(object sender, EventArgs e)
        {
            this.PrintReport();
        }

        [DebuggerNonUserCode]
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (disposing && (this.components != null))
                {
                    this.components.Dispose();
                }
            }
            finally
            {
                base.Dispose(disposing);
            }
        }

        private void Frm_RptHTongDoanhThuBanHang_Load(object sender, EventArgs e)
        {
            LVYModule.GetUserRight(ref this.mAllowView, ref this.mAllowDel, ref this.mAllowEdit, ref this.mAllowAdd, Conversions.ToString(this.Tag), modGeneral.H_USERNAME);
            if (!this.mAllowView)
            {
                LVYModule.ShowWarning(modGeneral.Tranlated("Bạn kh\x00f4ng c\x00f3 quyền xem, li\x00ean hệ với người quản trị để biết th\x00eam chi tiết.", ""));
                this.Dispose();
            }
            else
            {
                this.SetLanguage();
                BuildComboModule.BuildCombo(this.CobDonVi, modGeneral.ListDanhMuc.DonVi, true, "", "");
                this.CobDonVi.SelectedValue = modGeneral.H_CLIENT;
                this.DTP_NgayBatDau.Text = "01/" + LVYModule.sRight("00" + Conversions.ToString(DateAndTime.Month(DateAndTime.Today)), 2) + "/" + Conversions.ToString(DateAndTime.Year(DateAndTime.Today));
            }
        }

        public DataTable GetDataPrintDoanhThuTongHop()
        {
            DataTable table;
            IDataParameter[] commandParameters = new IDataParameter[6];
            try
            {
                commandParameters[0] = DBHelper.createParameter("@KhoaDonVi", DbType.Int64, ParameterDirection.Input, RuntimeHelpers.GetObjectValue(this.CobDonVi.SelectedValue));
                commandParameters[1] = DBHelper.createParameter("@TuNgay", DbType.Int64, ParameterDirection.Input, LVYModule.Date2Char(this.DTP_NgayBatDau.Text));
                commandParameters[2] = DBHelper.createParameter("@DenNgay", DbType.Int64, ParameterDirection.Input, LVYModule.Date2Char(this.DTP_NgayKetThuc.Text));
                table = DBHelper.ExecuteDataset(modGeneral.ConnectionString, CommandType.StoredProcedure, "BH_BC_DoanhThuTongHop", commandParameters).Tables[0];
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                MessageBox.Show(exception.Message);
                table = null;
                ProjectData.ClearProjectError();
                return table;
                ProjectData.ClearProjectError();
            }
            return table;
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(Frm_RptDoanhThuTongHop));
            this.CmdCancel = new Button();
            this.CobDonVi = new ComboBox();
            this.LBDonVi = new Label();
            this.LBTuNgay = new Label();
            this.CmdOK = new Button();
            this.DTP_NgayKetThuc = new DateTimePicker();
            this.GBTuyChon = new GroupBox();
            this.DTP_NgayBatDau = new DateTimePicker();
            this.LBDenNgay = new Label();
            this.Panel1 = new Panel();
            this.GBTuyChon.SuspendLayout();
            this.Panel1.SuspendLayout();
            this.SuspendLayout();
            this.CmdCancel.DialogResult = DialogResult.Cancel;
            this.CmdCancel.Image = (Image) manager.GetObject("CmdCancel.Image");
            this.CmdCancel.ImageAlign = ContentAlignment.MiddleLeft;
            Point point = new Point(0x12d, 3);
            this.CmdCancel.Location = point;
            this.CmdCancel.Name = "CmdCancel";
            Size size = new Size(0x4f, 0x18);
            this.CmdCancel.Size = size;
            this.CmdCancel.TabIndex = 0x26;
            this.CmdCancel.Text = "&Tho\x00e1t";
            this.CmdCancel.UseVisualStyleBackColor = true;
            this.CobDonVi.DropDownStyle = ComboBoxStyle.DropDownList;
            this.CobDonVi.FormattingEnabled = true;
            point = new Point(0x5c, 0x20);
            this.CobDonVi.Location = point;
            this.CobDonVi.Name = "CobDonVi";
            size = new Size(0x10d, 0x15);
            this.CobDonVi.Size = size;
            this.CobDonVi.TabIndex = 6;
            this.LBDonVi.AutoSize = true;
            point = new Point(0x11, 0x23);
            this.LBDonVi.Location = point;
            this.LBDonVi.Name = "LBDonVi";
            size = new Size(0x2c, 13);
            this.LBDonVi.Size = size;
            this.LBDonVi.TabIndex = 7;
            this.LBDonVi.Text = "Đơn vị :";
            this.LBTuNgay.AutoSize = true;
            point = new Point(14, 0x44);
            this.LBTuNgay.Location = point;
            this.LBTuNgay.Name = "LBTuNgay";
            size = new Size(0x34, 13);
            this.LBTuNgay.Size = size;
            this.LBTuNgay.TabIndex = 2;
            this.LBTuNgay.Text = "Từ ng\x00e0y :";
            this.CmdOK.Image = (Image) manager.GetObject("CmdOK.Image");
            this.CmdOK.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(0xda, 3);
            this.CmdOK.Location = point;
            this.CmdOK.Name = "CmdOK";
            size = new Size(0x4e, 0x18);
            this.CmdOK.Size = size;
            this.CmdOK.TabIndex = 0x25;
            this.CmdOK.Text = "&Chọn";
            this.CmdOK.UseVisualStyleBackColor = true;
            this.DTP_NgayKetThuc.Format = DateTimePickerFormat.Short;
            point = new Point(0x10b, 0x40);
            this.DTP_NgayKetThuc.Location = point;
            this.DTP_NgayKetThuc.Name = "DTP_NgayKetThuc";
            size = new Size(0x5e, 20);
            this.DTP_NgayKetThuc.Size = size;
            this.DTP_NgayKetThuc.TabIndex = 5;
            this.GBTuyChon.BackColor = Color.Transparent;
            this.GBTuyChon.Controls.Add(this.LBDonVi);
            this.GBTuyChon.Controls.Add(this.CobDonVi);
            this.GBTuyChon.Controls.Add(this.DTP_NgayBatDau);
            this.GBTuyChon.Controls.Add(this.DTP_NgayKetThuc);
            this.GBTuyChon.Controls.Add(this.LBTuNgay);
            this.GBTuyChon.Controls.Add(this.LBDenNgay);
            this.GBTuyChon.Dock = DockStyle.Fill;
            point = new Point(0, 0);
            this.GBTuyChon.Location = point;
            this.GBTuyChon.Name = "GBTuyChon";
            size = new Size(0x188, 0x7b);
            this.GBTuyChon.Size = size;
            this.GBTuyChon.TabIndex = 0x24;
            this.GBTuyChon.TabStop = false;
            this.GBTuyChon.Text = "T\x00f9y chọn";
            this.DTP_NgayBatDau.Format = DateTimePickerFormat.Short;
            point = new Point(0x5c, 0x40);
            this.DTP_NgayBatDau.Location = point;
            this.DTP_NgayBatDau.Name = "DTP_NgayBatDau";
            size = new Size(0x5e, 20);
            this.DTP_NgayBatDau.Size = size;
            this.DTP_NgayBatDau.TabIndex = 4;
            this.LBDenNgay.AutoSize = true;
            point = new Point(0xcd, 0x44);
            this.LBDenNgay.Location = point;
            this.LBDenNgay.Name = "LBDenNgay";
            size = new Size(0x3b, 13);
            this.LBDenNgay.Size = size;
            this.LBDenNgay.TabIndex = 3;
            this.LBDenNgay.Text = "Đến ng\x00e0y :";
            this.Panel1.BackColor = Color.Transparent;
            this.Panel1.Controls.Add(this.CmdCancel);
            this.Panel1.Controls.Add(this.CmdOK);
            this.Panel1.Dock = DockStyle.Bottom;
            point = new Point(0, 0x7b);
            this.Panel1.Location = point;
            this.Panel1.Name = "Panel1";
            size = new Size(0x188, 30);
            this.Panel1.Size = size;
            this.Panel1.TabIndex = 0x27;
            SizeF ef = new SizeF(6f, 13f);
            this.AutoScaleDimensions = ef;
            this.AutoScaleMode = AutoScaleMode.Font;
            this.BackgroundImage = ACCOUNTING.My.Resources.Resources.background;
            size = new Size(0x188, 0x99);
            this.ClientSize = size;
            this.ControlBox = false;
            this.Controls.Add(this.GBTuyChon);
            this.Controls.Add(this.Panel1);
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "Frm_RptDoanhThuTongHop";
            this.StartPosition = FormStartPosition.CenterScreen;
            this.Tag = "BC-BH16";
            this.Text = "DOANH THU TONG HOP";
            this.GBTuyChon.ResumeLayout(false);
            this.GBTuyChon.PerformLayout();
            this.Panel1.ResumeLayout(false);
            this.ResumeLayout(false);
        }

        public void PrintReport()
        {
            DataTable dataPrintDoanhThuTongHop = this.GetDataPrintDoanhThuTongHop();
            if (dataPrintDoanhThuTongHop.Rows.Count < 1)
            {
                Interaction.MsgBox("Kh\x00f4ng c\x00f3 dữ liệu", MsgBoxStyle.OkOnly, "In");
                this.Cursor = Cursors.Default;
            }
            else
            {
                string val = modGeneral.Tranlated("Từ ng\x00e0y", "") + " : " + this.DTP_NgayBatDau.Text + " " + modGeneral.Tranlated("đến ng\x00e0y", "") + " : " + this.DTP_NgayKetThuc.Text;
                this.Cursor = Cursors.WaitCursor;
                Rpt_TongHopDoanhThu thu = new Rpt_TongHopDoanhThu();
                try
                {
                    thu.SetDataSource(dataPrintDoanhThuTongHop);
                    thu.SetParameterValue(0, modGeneral.H_COMPANYNAMEVIET);
                    thu.SetParameterValue(1, modGeneral.Tranlated("Địa chỉ", "") + ": " + modGeneral.H_ADDRESS);
                    thu.SetParameterValue(2, modGeneral.Tranlated("Mã s\x00f4́ thu\x00eá", "") + ": " + modGeneral.H_TAXCODE);
                    thu.SetParameterValue(3, modGeneral.Tranlated("Điện thoại", "") + ": " + modGeneral.H_TELEPHONE);
                    thu.SetParameterValue(4, modGeneral.Tranlated("Fax", "") + ": " + modGeneral.H_FAX);
                    thu.SetParameterValue(5, val);
                    MyProject.Forms.Frm_ViewReport.ReportViewer.ReportSource = thu;
                    MyProject.Forms.Frm_ViewReport.ReportViewer.DisplayGroupTree = false;
                    this.Cursor = Cursors.Default;
                    MyProject.Forms.Frm_ViewReport.ShowDialog();
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Exception exception = exception1;
                    MessageBox.Show(exception.Message.ToString());
                    ProjectData.ClearProjectError();
                }
            }
        }

        public void SetLanguage()
        {
            this.Text = modGeneral.Tranlated(this.Text, "");
            this.GBTuyChon.Text = modGeneral.Tranlated(this.GBTuyChon.Text, "");
            this.LBDonVi.Text = modGeneral.Tranlated(this.LBDonVi.Text, "");
            this.LBTuNgay.Text = modGeneral.Tranlated(this.LBTuNgay.Text, "");
            this.LBDenNgay.Text = modGeneral.Tranlated(this.LBDenNgay.Text, "");
            this.CmdOK.Text = modGeneral.Tranlated(this.CmdOK.Text, "");
            this.CmdCancel.Text = modGeneral.Tranlated(this.CmdCancel.Text, "");
        }

        internal virtual Button CmdCancel
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdCancel;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._CmdCancel = value;
            }
        }

        internal virtual Button CmdOK
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdOK;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdOK_Click);
                if (this._CmdOK != null)
                {
                    this._CmdOK.Click -= handler;
                }
                this._CmdOK = value;
                if (this._CmdOK != null)
                {
                    this._CmdOK.Click += handler;
                }
            }
        }

        internal virtual ComboBox CobDonVi
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CobDonVi;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._CobDonVi = value;
            }
        }

        internal virtual DateTimePicker DTP_NgayBatDau
        {
            [DebuggerNonUserCode]
            get
            {
                return this._DTP_NgayBatDau;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._DTP_NgayBatDau = value;
            }
        }

        internal virtual DateTimePicker DTP_NgayKetThuc
        {
            [DebuggerNonUserCode]
            get
            {
                return this._DTP_NgayKetThuc;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._DTP_NgayKetThuc = value;
            }
        }

        internal virtual GroupBox GBTuyChon
        {
            [DebuggerNonUserCode]
            get
            {
                return this._GBTuyChon;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._GBTuyChon = value;
            }
        }

        internal virtual Label LBDenNgay
        {
            [DebuggerNonUserCode]
            get
            {
                return this._LBDenNgay;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._LBDenNgay = value;
            }
        }

        internal virtual Label LBDonVi
        {
            [DebuggerNonUserCode]
            get
            {
                return this._LBDonVi;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._LBDonVi = value;
            }
        }

        internal virtual Label LBTuNgay
        {
            [DebuggerNonUserCode]
            get
            {
                return this._LBTuNgay;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._LBTuNgay = value;
            }
        }

        internal virtual Panel Panel1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel1 = value;
            }
        }
    }
}

